package com.ldu.dao.impl;

import com.ldu.dao.query.support.PageResult;
import com.ldu.dao.dataobject.AdminDO;
import com.ldu.dao.query.AdminQuery;
import com.ldu.dao.mapper.ext.AdminExtMapper;
import com.ldu.dao.intf.AdminManager;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * Manager for Admin.
 */

@Component
public class AdminManagerImpl implements AdminManager{

    
    @Autowired
    protected AdminExtMapper adminExtMapper;
    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(AdminQuery query){
        return adminExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(AdminQuery query){
        return adminExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(AdminDO record){
        return adminExtMapper.deleteByPrimaryKey(record);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(AdminDO record){
        return adminExtMapper.insertSelective(record);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<AdminDO> selectByQuery(AdminQuery query){
        return adminExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
    */
    @Override
    public PageResult<AdminDO> selectByQueryWithPage(AdminQuery query) {
        PageResult<AdminDO> result = new PageResult<AdminDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public AdminDO selectByPrimaryKey(Long id){
        return adminExtMapper.selectByPrimaryKey(id);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective( AdminDO record,  AdminQuery query){
        return adminExtMapper.updateByQuerySelective(record,  query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery( AdminDO record,  AdminQuery query){

        return adminExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(AdminDO record){
        return adminExtMapper.updateByPrimaryKeySelective(record);
    }
}